<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>vec2 - p2.js</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="p2.js" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: 0.7.1</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/AABB.html">AABB</a></li>
                                <li><a href="../classes/AngleLockEquation.html">AngleLockEquation</a></li>
                                <li><a href="../classes/Body.html">Body</a></li>
                                <li><a href="../classes/Box.html">Box</a></li>
                                <li><a href="../classes/Broadphase.html">Broadphase</a></li>
                                <li><a href="../classes/Capsule.html">Capsule</a></li>
                                <li><a href="../classes/Circle.html">Circle</a></li>
                                <li><a href="../classes/Constraint.html">Constraint</a></li>
                                <li><a href="../classes/ContactEquation.html">ContactEquation</a></li>
                                <li><a href="../classes/ContactMaterial.html">ContactMaterial</a></li>
                                <li><a href="../classes/Convex.html">Convex</a></li>
                                <li><a href="../classes/DistanceConstraint.html">DistanceConstraint</a></li>
                                <li><a href="../classes/Equation.html">Equation</a></li>
                                <li><a href="../classes/EventEmitter.html">EventEmitter</a></li>
                                <li><a href="../classes/FrictionEquation.html">FrictionEquation</a></li>
                                <li><a href="../classes/GearConstraint.html">GearConstraint</a></li>
                                <li><a href="../classes/GSSolver.html">GSSolver</a></li>
                                <li><a href="../classes/Heightfield.html">Heightfield</a></li>
                                <li><a href="../classes/Island.html">Island</a></li>
                                <li><a href="../classes/IslandManager.html">IslandManager</a></li>
                                <li><a href="../classes/IslandNode.html">IslandNode</a></li>
                                <li><a href="../classes/Line.html">Line</a></li>
                                <li><a href="../classes/LinearSpring.html">LinearSpring</a></li>
                                <li><a href="../classes/LockConstraint.html">LockConstraint</a></li>
                                <li><a href="../classes/Material.html">Material</a></li>
                                <li><a href="../classes/NaiveBroadphase.html">NaiveBroadphase</a></li>
                                <li><a href="../classes/Narrowphase.html">Narrowphase</a></li>
                                <li><a href="../classes/Object pooling utility..html">Object pooling utility.</a></li>
                                <li><a href="../classes/OverlapKeeper.html">OverlapKeeper</a></li>
                                <li><a href="../classes/OverlapKeeperRecord.html">OverlapKeeperRecord</a></li>
                                <li><a href="../classes/Particle.html">Particle</a></li>
                                <li><a href="../classes/Plane.html">Plane</a></li>
                                <li><a href="../classes/PrismaticConstraint.html">PrismaticConstraint</a></li>
                                <li><a href="../classes/Ray.html">Ray</a></li>
                                <li><a href="../classes/RaycastResult.html">RaycastResult</a></li>
                                <li><a href="../classes/RevoluteConstraint.html">RevoluteConstraint</a></li>
                                <li><a href="../classes/RotationalLockEquation.html">RotationalLockEquation</a></li>
                                <li><a href="../classes/.html"></a></li>
                                <li><a href="../classes/RotationalSpring.html">RotationalSpring</a></li>
                                <li><a href="../classes/RotationalVelocityEquation.html">RotationalVelocityEquation</a></li>
                                <li><a href="../classes/SAPBroadphase.html">SAPBroadphase</a></li>
                                <li><a href="../classes/Shape.html">Shape</a></li>
                                <li><a href="../classes/Solver.html">Solver</a></li>
                                <li><a href="../classes/Spring.html">Spring</a></li>
                                <li><a href="../classes/TopDownVehicle.html">TopDownVehicle</a></li>
                                <li><a href="../classes/TupleDictionary.html">TupleDictionary</a></li>
                                <li><a href="../classes/Utils.html">Utils</a></li>
                                <li><a href="../classes/vec2.html">vec2</a></li>
                                <li><a href="../classes/WheelConstraint.html">WheelConstraint</a></li>
                                <li><a href="../classes/World.html">World</a></li>
                            </ul>
                
                            <ul id="api-modules" class="apis modules">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1>vec2 Class</h1>
<div class="box meta">


        <div class="foundat">
            Defined in: <a href="../files/src_math_vec2.js.html#l23"><code>src&#x2F;math&#x2F;vec2.js:23</code></a>
        </div>


</div>


<div class="box intro">
    <p>The vec2 object from glMatrix, with some extensions and some removed methods. See <a href="http://glmatrix.net">http://glmatrix.net</a>.</p>

</div>


<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                            <li class="index-item method">
                                <a href="#method_add">add</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_centroid">centroid</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_clone">clone</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_copy">copy</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_create">create</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_crossLength">crossLength</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_crossVZ">crossVZ</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_crossZV">crossZV</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_dist">dist</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_distance">distance</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_div">div</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_divide">divide</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_dot">dot</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_fromValues">fromValues</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getLineSegmentsIntersection">getLineSegmentsIntersection</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getLineSegmentsIntersectionFraction">getLineSegmentsIntersectionFraction</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_len">len</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_length">length</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_lerp">lerp</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_mul">mul</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_multiply">multiply</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_negate">negate</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_normalize">normalize</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_reflect">reflect</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_rotate">rotate</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_rotate90cw">rotate90cw</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_scale">scale</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_set">set</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_sqrDist">sqrDist</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_sqrLen">sqrLen</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_squaredDistance">squaredDistance</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_squaredLength">squaredLength</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_str">str</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_sub">sub</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_subtract">subtract</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_toGlobalFrame">toGlobalFrame</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_toGlobalFrame">toGlobalFrame</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_toLocalFrame">toLocalFrame</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_vectorToLocalFrame">vectorToLocalFrame</a>

                            </li>
                    </ul>
                </div>



        </div>

            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

<div id="method_add" class="method item">
    <h3 class="name"><code>add</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l249"><code>src&#x2F;math&#x2F;vec2.js:249</code></a>
        </p>



    </div>

    <div class="description">
        <p>Adds two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_centroid" class="method item">
    <h3 class="name"><code>centroid</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
                <li class="arg">
                        <code>c</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l161"><code>src&#x2F;math&#x2F;vec2.js:161</code></a>
        </p>



    </div>

    <div class="description">
        <p>Compute centroid of a triangle spanned by vectors a,b,c. See <a href="http://easycalculation.com/analytical/learn-centroid.php">http://easycalculation.com/analytical/learn-centroid.php</a></p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">c</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>The out object</p>

            </div>
        </div>


</div>
<div id="method_clone" class="method item">
    <h3 class="name"><code>clone</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l191"><code>src&#x2F;math&#x2F;vec2.js:191</code></a>
        </p>



    </div>

    <div class="description">
        <p>Creates a new vec2 initialized with values from an existing vector</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>vector to clone</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>a new 2D vector</p>

            </div>
        </div>


</div>
<div id="method_copy" class="method item">
    <h3 class="name"><code>copy</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l220"><code>src&#x2F;math&#x2F;vec2.js:220</code></a>
        </p>



    </div>

    <div class="description">
        <p>Copy the values from one vec2 to another</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the source vector</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_create" class="method item">
    <h3 class="name"><code>create</code></h3>

        <span class="paren">()</span>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l178"><code>src&#x2F;math&#x2F;vec2.js:178</code></a>
        </p>



    </div>

    <div class="description">
        <p>Creates a new, empty vec2</p>

    </div>


        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>a new 2D vector</p>

            </div>
        </div>


</div>
<div id="method_crossLength" class="method item">
    <h3 class="name"><code>crossLength</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l32"><code>src&#x2F;math&#x2F;vec2.js:32</code></a>
        </p>



    </div>

    <div class="description">
        <p>Make a cross product and only return the z component</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
            </div>
        </div>


</div>
<div id="method_crossVZ" class="method item">
    <h3 class="name"><code>crossVZ</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>vec</code>
                </li>
                <li class="arg">
                        <code>zcomp</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l44"><code>src&#x2F;math&#x2F;vec2.js:44</code></a>
        </p>



    </div>

    <div class="description">
        <p>Cross product between a vector and the Z component of a vector</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">vec</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">zcomp</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
            </div>
        </div>


</div>
<div id="method_crossZV" class="method item">
    <h3 class="name"><code>crossZV</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>zcomp</code>
                </li>
                <li class="arg">
                        <code>vec</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l59"><code>src&#x2F;math&#x2F;vec2.js:59</code></a>
        </p>



    </div>

    <div class="description">
        <p>Cross product between a vector and the Z component of a vector</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">zcomp</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">vec</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
            </div>
        </div>


</div>
<div id="method_dist" class="method item">
    <h3 class="name"><code>dist</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l359"><code>src&#x2F;math&#x2F;vec2.js:359</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.distance</p>

    </div>




</div>
<div id="method_distance" class="method item">
    <h3 class="name"><code>distance</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l345"><code>src&#x2F;math&#x2F;vec2.js:345</code></a>
        </p>



    </div>

    <div class="description">
        <p>Calculates the euclidian distance between two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
                    <p>distance between a and b</p>

            </div>
        </div>


</div>
<div id="method_div" class="method item">
    <h3 class="name"><code>div</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l323"><code>src&#x2F;math&#x2F;vec2.js:323</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.divide</p>

    </div>




</div>
<div id="method_divide" class="method item">
    <h3 class="name"><code>divide</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l308"><code>src&#x2F;math&#x2F;vec2.js:308</code></a>
        </p>



    </div>

    <div class="description">
        <p>Divides two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_dot" class="method item">
    <h3 class="name"><code>dot</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l462"><code>src&#x2F;math&#x2F;vec2.js:462</code></a>
        </p>



    </div>

    <div class="description">
        <p>Calculates the dot product of two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
                    <p>dot product of a and b</p>

            </div>
        </div>


</div>
<div id="method_fromValues" class="method item">
    <h3 class="name"><code>fromValues</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>x</code>
                </li>
                <li class="arg">
                        <code>y</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l205"><code>src&#x2F;math&#x2F;vec2.js:205</code></a>
        </p>



    </div>

    <div class="description">
        <p>Creates a new vec2 initialized with the given values</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">x</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>X component</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">y</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>Y component</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>a new 2D vector</p>

            </div>
        </div>


</div>
<div id="method_getLineSegmentsIntersection" class="method item">
    <h3 class="name"><code>getLineSegmentsIntersection</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>p0</code>
                </li>
                <li class="arg">
                        <code>p1</code>
                </li>
                <li class="arg">
                        <code>p2</code>
                </li>
                <li class="arg">
                        <code>p3</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Boolean</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l516"><code>src&#x2F;math&#x2F;vec2.js:516</code></a>
        </p>



    </div>

    <div class="description">
        <p>Get the intersection point between two line segments.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p0</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p1</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p2</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p3</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Boolean</span>:
                    <p>True if there was an intersection, otherwise false.</p>

            </div>
        </div>


</div>
<div id="method_getLineSegmentsIntersectionFraction" class="method item">
    <h3 class="name"><code>getLineSegmentsIntersectionFraction</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>p0</code>
                </li>
                <li class="arg">
                        <code>p1</code>
                </li>
                <li class="arg">
                        <code>p2</code>
                </li>
                <li class="arg">
                        <code>p3</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l538"><code>src&#x2F;math&#x2F;vec2.js:538</code></a>
        </p>



    </div>

    <div class="description">
        <p>Get the intersection fraction between two line segments. If successful, the intersection is at p0 + t * (p1 - p0)</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">p0</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p1</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p2</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">p3</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
                    <p>A number between 0 and 1 if there was an intersection, otherwise -1.</p>

            </div>
        </div>


</div>
<div id="method_len" class="method item">
    <h3 class="name"><code>len</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l400"><code>src&#x2F;math&#x2F;vec2.js:400</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.length</p>

    </div>




</div>
<div id="method_length" class="method item">
    <h3 class="name"><code>length</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l387"><code>src&#x2F;math&#x2F;vec2.js:387</code></a>
        </p>



    </div>

    <div class="description">
        <p>Calculates the length of a vec2</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>vector to calculate length of</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
                    <p>length of a</p>

            </div>
        </div>


</div>
<div id="method_lerp" class="method item">
    <h3 class="name"><code>lerp</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
                <li class="arg">
                        <code>t</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l485"><code>src&#x2F;math&#x2F;vec2.js:485</code></a>
        </p>



    </div>

    <div class="description">
        <p>Linearly interpolate/mix two vectors.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>First vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>Second vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">t</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>Lerp factor</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_mul" class="method item">
    <h3 class="name"><code>mul</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l301"><code>src&#x2F;math&#x2F;vec2.js:301</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.multiply</p>

    </div>




</div>
<div id="method_multiply" class="method item">
    <h3 class="name"><code>multiply</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l286"><code>src&#x2F;math&#x2F;vec2.js:286</code></a>
        </p>



    </div>

    <div class="description">
        <p>Multiplies two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_negate" class="method item">
    <h3 class="name"><code>negate</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l427"><code>src&#x2F;math&#x2F;vec2.js:427</code></a>
        </p>



    </div>

    <div class="description">
        <p>Negates the components of a vec2</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>vector to negate</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_normalize" class="method item">
    <h3 class="name"><code>normalize</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l441"><code>src&#x2F;math&#x2F;vec2.js:441</code></a>
        </p>



    </div>

    <div class="description">
        <p>Normalize a vec2</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>vector to normalize</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_reflect" class="method item">
    <h3 class="name"><code>reflect</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>vector</code>
                </li>
                <li class="arg">
                        <code>normal</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l502"><code>src&#x2F;math&#x2F;vec2.js:502</code></a>
        </p>



    </div>

    <div class="description">
        <p>Reflect a vector along a normal.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">vector</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">normal</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_rotate" class="method item">
    <h3 class="name"><code>rotate</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>angle</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l74"><code>src&#x2F;math&#x2F;vec2.js:74</code></a>
        </p>



    </div>

    <div class="description">
        <p>Rotate a vector by an angle</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">angle</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_rotate90cw" class="method item">
    <h3 class="name"><code>rotate90cw</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>angle</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l96"><code>src&#x2F;math&#x2F;vec2.js:96</code></a>
        </p>



    </div>

    <div class="description">
        <p>Rotate a vector 90 degrees clockwise</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">angle</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_scale" class="method item">
    <h3 class="name"><code>scale</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l330"><code>src&#x2F;math&#x2F;vec2.js:330</code></a>
        </p>



    </div>

    <div class="description">
        <p>Scales a vec2 by a scalar number</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the vector to scale</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>amount to scale the vector by</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_set" class="method item">
    <h3 class="name"><code>set</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>x</code>
                </li>
                <li class="arg">
                        <code>y</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l234"><code>src&#x2F;math&#x2F;vec2.js:234</code></a>
        </p>



    </div>

    <div class="description">
        <p>Set the components of a vec2 to the given values</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">x</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>X component</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">y</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                        <p>Y component</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_sqrDist" class="method item">
    <h3 class="name"><code>sqrDist</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l380"><code>src&#x2F;math&#x2F;vec2.js:380</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.squaredDistance</p>

    </div>




</div>
<div id="method_sqrLen" class="method item">
    <h3 class="name"><code>sqrLen</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l420"><code>src&#x2F;math&#x2F;vec2.js:420</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.squaredLength</p>

    </div>




</div>
<div id="method_squaredDistance" class="method item">
    <h3 class="name"><code>squaredDistance</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l366"><code>src&#x2F;math&#x2F;vec2.js:366</code></a>
        </p>



    </div>

    <div class="description">
        <p>Calculates the squared euclidian distance between two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
                    <p>squared distance between a and b</p>

            </div>
        </div>


</div>
<div id="method_squaredLength" class="method item">
    <h3 class="name"><code>squaredLength</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>a</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Number</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l407"><code>src&#x2F;math&#x2F;vec2.js:407</code></a>
        </p>



    </div>

    <div class="description">
        <p>Calculates the squared length of a vec2</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>vector to calculate squared length of</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Number</span>:
                    <p>squared length of a</p>

            </div>
        </div>


</div>
<div id="method_str" class="method item">
    <h3 class="name"><code>str</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>vec</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">String</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l474"><code>src&#x2F;math&#x2F;vec2.js:474</code></a>
        </p>



    </div>

    <div class="description">
        <p>Returns a string representation of a vector</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">vec</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>vector to represent as a string</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">String</span>:
                    <p>string representation of the vector</p>

            </div>
        </div>


</div>
<div id="method_sub" class="method item">
    <h3 class="name"><code>sub</code></h3>

        <span class="paren">()</span>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l279"><code>src&#x2F;math&#x2F;vec2.js:279</code></a>
        </p>



    </div>

    <div class="description">
        <p>Alias for vec2.subtract</p>

    </div>




</div>
<div id="method_subtract" class="method item">
    <h3 class="name"><code>subtract</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>a</code>
                </li>
                <li class="arg">
                        <code>b</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Array</span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l264"><code>src&#x2F;math&#x2F;vec2.js:264</code></a>
        </p>



    </div>

    <div class="description">
        <p>Subtracts two vec2&#39;s</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the receiving vector</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">a</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the first operand</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">b</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                        <p>the second operand</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Array</span>:
                    <p>out</p>

            </div>
        </div>


</div>
<div id="method_toGlobalFrame" class="method item">
    <h3 class="name"><code>toGlobalFrame</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>localPoint</code>
                </li>
                <li class="arg">
                        <code>framePosition</code>
                </li>
                <li class="arg">
                        <code>frameAngle</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l125"><code>src&#x2F;math&#x2F;vec2.js:125</code></a>
        </p>



    </div>

    <div class="description">
        <p>Transform a point position to global frame.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">localPoint</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">framePosition</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">frameAngle</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_toGlobalFrame" class="method item">
    <h3 class="name"><code>toGlobalFrame</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>localVector</code>
                </li>
                <li class="arg">
                        <code>frameAngle</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l150"><code>src&#x2F;math&#x2F;vec2.js:150</code></a>
        </p>



    </div>

    <div class="description">
        <p>Transform a point position to global frame.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">localVector</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">frameAngle</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_toLocalFrame" class="method item">
    <h3 class="name"><code>toLocalFrame</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>worldPoint</code>
                </li>
                <li class="arg">
                        <code>framePosition</code>
                </li>
                <li class="arg">
                        <code>frameAngle</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l111"><code>src&#x2F;math&#x2F;vec2.js:111</code></a>
        </p>



    </div>

    <div class="description">
        <p>Transform a point position to local frame.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">worldPoint</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">framePosition</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">frameAngle</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_vectorToLocalFrame" class="method item">
    <h3 class="name"><code>vectorToLocalFrame</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>out</code>
                </li>
                <li class="arg">
                        <code>worldVector</code>
                </li>
                <li class="arg">
                        <code>frameAngle</code>
                </li>
            </ul><span class="paren">)</span>
        </div>








    <div class="meta">
                <p>
                Defined in
        <a href="../files/src_math_vec2.js.html#l139"><code>src&#x2F;math&#x2F;vec2.js:139</code></a>
        </p>



    </div>

    <div class="description">
        <p>Transform a vector to local frame.</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">out</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">worldVector</code>
                        <span class="type">Array</span>


                    <div class="param-description">
                         
                    </div>

                </li>
                <li class="param">
                        <code class="param-name">frameAngle</code>
                        <span class="type">Number</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



</div>
            </div>



    </div>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
